function CModeMenu(){
    var _oBg;
    var _oContainerEasy;
    var _oContainerNormal;
    var _oBorder1;
    var _oMode1;
    var _oTextModeBack1;
    var _oTextMode1;
    var _oTextEasyBack;
    var _oTextEasy;
    var _oBorder3;
    var _oMode3;
    var _oTextModeBack3;
    var _oTextMode3;
    var _oTextNormalBack;
    var _oTextNormal;
    
    var _oTextTopBack;
    var _oTextTop;
    
    var _oParent;
    
    var _oButPlay;
    var _oFade;
    var _oAudioToggle;
    
    var _pStartPosAudio; 
    
    this._init = function(){
        _oBg = createBitmap(s_oSpriteLibrary.getSprite('bg_difficulty'));
        s_oStage.addChild(_oBg);
        
        var oTable = s_oSpriteLibrary.getSprite('layout_panel');
        
        var oTablePos = {x: CANVAS_WIDTH/4, y: 374};//Set symmetrical position of the modality buttons
        
        _oContainerEasy = new createjs.Container();
        _oContainerEasy.x = oTablePos.x;
        _oContainerEasy.y = oTablePos.y;
        
        _oContainerNormal = new createjs.Container();
        _oContainerNormal.x = CANVAS_WIDTH - oTablePos.x - oTable.width;
        _oContainerNormal.y = oTablePos.y; 
        
        var oTable1 = s_oSpriteLibrary.getSprite('layout_panel');
        _oBorder1 = createBitmap(oTable1);
        _oContainerEasy.addChild(_oBorder1);
        
        _oMode1 = createBitmap(s_oSpriteLibrary.getSprite('layout_1_card'));
        _oMode1.x = 35;
        _oMode1.y = 115;        
        _oContainerEasy.addChild(_oMode1);

        _oTextModeBack1 = new createjs.Text(TEXT_MODE_1,"bold 28px "+PRIMARY_FONT, "#000000");
        _oTextModeBack1.x = 124;
        _oTextModeBack1.y = 90;
		_oTextModeBack1.textBaseline = "alphabetic";
        _oTextModeBack1.textAlign = "center";
        _oTextModeBack1.lineWidth = 300;
        _oTextModeBack1.alpha=0.6;
        _oContainerEasy.addChild(_oTextModeBack1);

        _oTextMode1 = new createjs.Text(TEXT_MODE_1,"bold 28px "+PRIMARY_FONT, "#ffffff");
        _oTextMode1.x = 122;
        _oTextMode1.y = 88;
		_oTextMode1.textBaseline = "alphabetic";
        _oTextMode1.textAlign = "center";
        _oTextMode1.lineWidth = 300;
        _oContainerEasy.addChild(_oTextMode1);

        _oTextEasyBack = new createjs.Text(TEXT_EASY,"bold 34px "+PRIMARY_FONT, "#000000");
        _oTextEasyBack.x = 124;
        _oTextEasyBack.y = 37;
		_oTextEasyBack.textBaseline = "alphabetic";
        _oTextEasyBack.textAlign = "center";
        _oTextEasyBack.lineWidth = 300;
        _oTextEasyBack.alpha = 0.6;
        _oContainerEasy.addChild(_oTextEasyBack);

        _oTextEasy = new createjs.Text(TEXT_EASY,"bold 34px "+PRIMARY_FONT, "#ffffff");
        _oTextEasy.x = 122;
        _oTextEasy.y = 35;
		_oTextEasy.textBaseline = "alphabetic";
        _oTextEasy.textAlign = "center";
        _oTextEasy.lineWidth = 300;
        _oContainerEasy.addChild(_oTextEasy);
        
        

        oTable = s_oSpriteLibrary.getSprite('layout_panel');
        _oBorder3 = createBitmap(oTable);       
        _oContainerNormal.addChild(_oBorder3);        
        
        _oMode3 = createBitmap(s_oSpriteLibrary.getSprite('layout_3_card'));
        _oMode3.x =22;
        _oMode3.y =115;        
        _oContainerNormal.addChild(_oMode3);
        
        _oTextModeBack3 = new createjs.Text(TEXT_MODE_3,"bold 28px "+PRIMARY_FONT, "#000000");
        _oTextModeBack3.x = 124;
        _oTextModeBack3.y = 90;
		_oTextModeBack3.textBaseline = "alphabetic";
        _oTextModeBack3.textAlign = "center";
        _oTextModeBack3.lineWidth = 300;
        _oTextModeBack3.alpha=0.6;
        _oContainerNormal.addChild(_oTextModeBack3);
        
        _oTextMode3 = new createjs.Text(TEXT_MODE_3,"bold 28px "+PRIMARY_FONT, "#ffffff");
        _oTextMode3.x = 122;
        _oTextMode3.y = 88;
		_oTextMode3.textBaseline = "alphabetic";
        _oTextMode3.textAlign = "center";
        _oTextMode3.lineWidth = 300;
        _oContainerNormal.addChild(_oTextMode3);
        
        _oTextNormalBack = new createjs.Text(TEXT_NORMAL,"bold 34px "+PRIMARY_FONT, "#000000");
        _oTextNormalBack.x = 124;
        _oTextNormalBack.y = 37;
		_oTextNormalBack.textBaseline = "alphabetic";
        _oTextNormalBack.textAlign = "center";
        _oTextNormalBack.lineWidth = 300;
        _oTextNormalBack.alpha = 0.6;
        _oContainerNormal.addChild(_oTextNormalBack);
        
        _oTextNormal = new createjs.Text(TEXT_NORMAL,"bold 34px "+PRIMARY_FONT, "#ffffff");
        _oTextNormal.x = 125;
        _oTextNormal.y = 35;
		_oTextNormal.textBaseline = "alphabetic";
        _oTextNormal.textAlign = "center";
        _oTextNormal.lineWidth = 300;
        _oContainerNormal.addChild(_oTextNormal);
        
        _oTextTopBack = new createjs.Text(TEXT_TOP_MODE,"bold 52px "+PRIMARY_FONT, "#000000");
        _oTextTopBack.x = CANVAS_WIDTH/2+4;
        _oTextTopBack.y = (CANVAS_HEIGHT/2)-96;
        _oTextTopBack.textAlign = "center";
        _oTextTopBack.lineWidth = 800;
        _oTextTopBack.alpha=0.6;
        s_oStage.addChild(_oTextTopBack);
        
        _oTextTop = new createjs.Text(TEXT_TOP_MODE,"bold 52px "+PRIMARY_FONT, "#ffffff");
        _oTextTop.x = CANVAS_WIDTH/2;
        _oTextTop.y = (CANVAS_HEIGHT/2)-100;
        _oTextTop.textAlign = "center";
        _oTextTop.lineWidth = 800;
        s_oStage.addChild(_oTextTop);
        
        
        
        s_oStage.addChild(_oContainerEasy);
        s_oStage.addChild(_oContainerNormal);
        
        var graphics = new createjs.Graphics().beginFill("rgba(158,158,158,0.01)").drawRect(4, 0, 240, 250);
        var _oTargetDebug = new createjs.Shape(graphics);
        _oContainerEasy.addChild(_oTargetDebug);
        _oTargetDebug.on("mousedown", this._resizeEasy);
        _oTargetDebug.on("pressup", this._selectEasy);
        
        var _oNormalButton = new createjs.Shape(graphics);
        _oContainerNormal.addChild(_oNormalButton);
        _oNormalButton.on("mousedown", this._resizeNormal);
        _oNormalButton.on("pressup", this._selectNormal);        
       
        
        if(DISABLE_SOUND_MOBILE === false || s_bMobile === false){
            var oSprite = s_oSpriteLibrary.getSprite('audio_icon');
            _pStartPosAudio = {x: CANVAS_WIDTH - (oSprite.height/2)- 10, y: (oSprite.height/2) + 10};
            _oAudioToggle = new CToggle(_pStartPosAudio.x,_pStartPosAudio.y,oSprite,s_bAudioActive);
            _oAudioToggle.addEventListener(ON_MOUSE_UP, this._onAudioToggle, this);          
        }

        _oFade = new createjs.Shape();
        _oFade.graphics.beginFill("black").drawRect(0,0,CANVAS_WIDTH,CANVAS_HEIGHT);
        
        s_oStage.addChild(_oFade);
        
        createjs.Tween.get(_oFade).to({alpha:0}, 1000).call(function(){_oFade.visible = false;});  
        
        this.refreshButtonPos(s_iOffsetX, s_iOffsetY);
    };
    
    this.refreshButtonPos = function(iNewX,iNewY){
       
        if(DISABLE_SOUND_MOBILE === false || s_bMobile === false){
            _oAudioToggle.setPosition(_pStartPosAudio.x - iNewX,_pStartPosAudio.y);
        }
       
    };
    
    this._resizeEasy = function(){
        _oContainerEasy.x=_oContainerEasy.x +10;
        _oContainerEasy.y=_oContainerEasy.y +10;
        _oContainerEasy.scaleX=0.9;
        _oContainerEasy.scaleY=0.9;
        if(DISABLE_SOUND_MOBILE === false || s_bMobile === false){
            createjs.Sound.play("click");
        }
        
    };
    
    this._selectEasy = function(){
        
        if(DISABLE_SOUND_MOBILE === false || s_bMobile === false){
            createjs.Sound.play("click");
        }
        _oParent.unload();
        s_oMain.gotoGame(true);
    };
    
    this._resizeNormal = function(){
        _oContainerNormal.x=_oContainerNormal.x +10;
        _oContainerNormal.y=_oContainerNormal.y +10;
        _oContainerNormal.scaleX=0.9;
        _oContainerNormal.scaleY=0.9;
        if(DISABLE_SOUND_MOBILE === false || s_bMobile === false){
            createjs.Sound.play("click");
        }
        
    };
    
    this._selectNormal = function(){
        
        if(DISABLE_SOUND_MOBILE === false || s_bMobile === false){
            createjs.Sound.play("click");
        }
        _oParent.unload();
        s_oMain.gotoGame(false);
    };
    
    this.unload = function(){
        if(DISABLE_SOUND_MOBILE === false || s_bMobile === false){
            _oAudioToggle.unload();
            _oAudioToggle = null;
        }
        
        s_oStage.removeChild(_oBg, _oContainerEasy, _oContainerNormal);
        _oBg = null;
        
        s_oModeMenu = null;
    };
    
    this._onAudioToggle = function(){
        createjs.Sound.setMute(s_bAudioActive);
        s_bAudioActive = !s_bAudioActive;
    };
    
    this._onButPlayRelease = function(){
        this.unload();
        
        if(DISABLE_SOUND_MOBILE === false || s_bMobile === false){
            createjs.Sound.play("click");
        }
        
        s_oMain.gotoGame();
    };

    _oParent=this;
    s_oModeMenu = this;
    this._init();
}

var s_oModeMenu = null;